<link rel="stylesheet" type="text/css" href="<?php echo url::base(FALSE) ?>css/content.css">
<table>
    <tr><td id="dbstok">Database Stok Barang</td><td></td></tr>
    <tr colspan="5">
		<td align="center">
			<?php if (isset($errors)) : //jika ada variabel error?>
            <?php foreach ($errors as $error): ?>
            <div><?php echo $error ?></div>
            <?php endforeach ?>
            <?php endif ?>
		</td>
	</tr>
	<tr>
        <td width="70%" class="content">
            <table class="tabcontent" border="1" align="center" width="100%">
                <tr>
                    <td width="50">ID</td>
                    <td>Nama</td>
                    <td>Jumlah</td>
                    <td>Unit</td>                    
                </tr>
                <?php if (isset($stoks)): ?>
                    <?php foreach ($stoks->get_all_stok() as $stok) : ?>
                        <tr>
                            <td><?php echo $stok->ID_stok ?></td>
                            <td><?php echo $stok->nama ?></td>
                            <td><?php echo $stok->jumlah ?></td>
                            <td><?php echo $stok->unit ?></td>                            							
                        </tr>
                    <?php endforeach ?>
                <?php endif; ?>
            </table>
        </td>
        <td class="input">
            <div>
                <form action="<?php echo url::site() . 'stok' ?>" method="post" >
                    <table cellspacing="5">
                        <tr><td colspan="3" align="center">Tambah Jenis Barang Baru</td></tr>
                        <tr>
                            <td>Nama Barang</td><td style="width:5px">:</td><td align="right"><input name="nama" type="text"/></td>
                        </tr>                                           
                        <tr>
                            <td>Unit</td><td style="width:5px">:</td>
                            <td align="left">
                                <input name="unit" type="text"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2"></td><td align="right"><input type="submit" name="new_stock_submit" value="Submit" /></td>
                        </tr>
                    </table>
                </form>
            </div>
            <div style="margin: 0px auto">
                <form action="<?php echo url::site() . 'stok' ?>" method="post" >
                    <table cellspacing="5">
                        <tr><td colspan="3" align="center">Tambah Barang</td></tr>
                        <tr>
                            <td>Nama Barang</td><td style="width:5px">:</td>
                            <td align="left">
                                <select name="item">
                                    <?php foreach ($stoks->get_all_stok() as $stok) : ?>
                                        <option value="<?php echo $stok->nama ?>"> <?php echo $stok->nama ?> </option>
                                    <?php endforeach ?>                                    
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td>Jumlah</td><td style="width:5px">:</td><td align="right"><input name="quantity" type="text"/></td>
                        </tr>
						<tr>
                            <td>Harga Beli</td><td style="width:5px">:</td><td align="right"><input name="harga_beli" type="text"/></td>
                        </tr>						
                        <tr>
                            <td colspan="2"></td><td align="right"><input type="submit" name="inc_stock_submit" value="Submit" /></td>
                        </tr>
                    </table>
                </form>
            </div>
        </td>
    </tr>
</table>